package com.zboot.zbootadmin.common.utils;

public class ServiceResult<T> {

    private int code;
    private String message;
    private T content;

    private static <T> int $default$code() {
        return 0;
    }

    private static <T> String $default$message() {
        return "执行成功";
    }

    ServiceResult(final int code, final String message, final T content) {
        this.code = code;
        this.message = message;
        this.content = content;
    }

    public static <T> ServiceResult.ServiceResultBuilder<T> builder() {
        return new ServiceResult.ServiceResultBuilder();
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public T getContent() {
        return this.content;
    }

    public static class ServiceResultBuilder<T> {
        private boolean code$set;
        private int code$value;
        private boolean message$set;
        private String message$value;
        private T content;

        ServiceResultBuilder() {
        }

        public ServiceResult.ServiceResultBuilder<T> code(final int code) {
            this.code$value = code;
            this.code$set = true;
            return this;
        }

        public ServiceResult.ServiceResultBuilder<T> message(final String message) {
            this.message$value = message;
            this.message$set = true;
            return this;
        }

        public ServiceResult.ServiceResultBuilder<T> content(final T content) {
            this.content = content;
            return this;
        }

        public ServiceResult<T> build() {
            int code$value = this.code$value;
            if (!this.code$set) {
                code$value = ServiceResult.$default$code();
            }

            String message$value = this.message$value;
            if (!this.message$set) {
                message$value = ServiceResult.$default$message();
            }

            return new ServiceResult(code$value, message$value, this.content);
        }

        public String toString() {
            return "ServiceResult.ServiceResultBuilder(code$value=" + this.code$value + ", message$value=" + this.message$value + ", content=" + this.content + ")";
        }
    }
}
